package StudyCode.summary.mycollection;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class ReturnsTheIndexOfTheGreatestElementFromTheGivenArray {
	public static void main(String[] argv) {
		double[] value = new double[]{34.45, 35.45, 36.67, 37.78,
				37.0000, 37.1234, 67.2344, 68.34534, 69.87700};
		System.out.println("数组中最大元素的索引:" + maxIndex(value));
	}

	public static double maxIndex(double[] value) {
		double result = Double.NEGATIVE_INFINITY;
		int index = 0;
		for (int i = 0; i < value.length; i++) {
			if (value[i] > result)
				result = value[i];
			index = i;
		}
		return index;
	}
}
